//
//  HBHFindViewController.m
//  HubeiHotel
//
//  Created by 张露杰 on 17/11/13.
//  Copyright © 2017年 张露杰. All rights reserved.
//

#import "HBHFindViewController.h"
#import "ForumCell.h"
#import "ForumDetailViewController.h"
#import "FoeumSearchViewController.h"
#import "ForumFaBu.h"
#import "ZhaoPinViewController.h"
#import "AllScrollVViewController.h"
@interface HBHFindViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,strong)UITableView *tableV;
@property (nonatomic,strong)NSArray *imageArr;//图片数组

@end

@implementation HBHFindViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self creatView];
}

-(void)creatView
{
    [self initTitleWithTitle:@"发现"];
    _imageArr = @[@"zhaopinbanner",@"remenbanner",@"huodongbanner",@"chufabanner"];
    [self.view addSubview:self.tableV];
}

-(UITableView *)tableV//创建视图
{
    if (!_tableV) {
        _tableV = [[UITableView alloc] initWithFrame:CGRectMake(0,0, SCREENW, SCREENH-64-49) style:UITableViewStyleGrouped];
        _tableV.estimatedRowHeight = 80*screenW_6;
        _tableV.backgroundColor = [UIColor whiteColor];
        _tableV.separatorStyle = UITableViewCellSeparatorStyleNone;
        _tableV.showsVerticalScrollIndicator = NO;
        _tableV.delegate = self;
        _tableV.dataSource = self;
    }
    return _tableV;
}
#pragma Mark TableViewDelegate
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 0;
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 4;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 135*screenW_6;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 0.000001;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"tableCell"];
    if (cell == nil) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"tableCell"];
    }
    return cell;
}
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    //区头展示不同的图片
    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0,0,SCREENW, 135*screenW_6)];
    view.backgroundColor = [UIColor whiteColor];
    UIImageView *headerImageV = [[UIImageView alloc]initWithFrame:CGRectMake(10*screenW_6, 10*screenW_6, SCREENW-20*screenW_6, 125*screenW_6)];
    headerImageV.image = [UIImage imageNamed:_imageArr[section]];
    [view addSubview:headerImageV];
    headerImageV.userInteractionEnabled = YES;
    headerImageV.tag = section;
    UITapGestureRecognizer *Tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(imgageTap:)];
    [headerImageV addGestureRecognizer:Tap];
    return view;
}

-(void)imgageTap:(UITapGestureRecognizer *)tap
{
    if (tap.view.tag == 0){//招聘
        [self.navigationController pushViewController:[ZhaoPinViewController new] animated:YES];
    }else
    {
        NSString *typeId = @"";
        NSString *title = @"";
        if (tap.view.tag == 1) {
            typeId = @"54b3327204014cde90b8c08160563326";
            title = @"热门路线";
        }else if (tap.view.tag == 2){
            typeId = @"c6da22502da049e7bac92b4e1e8f666d";
            title = @"近期活动";
        }else if (tap.view.tag == 3){
            typeId = @"97467e5c143749139633e5aa54325e9d";
            title = @"现在出发";
        }
        AllScrollVViewController *hotVC = [AllScrollVViewController new];
        hotVC.parentId = typeId;
        hotVC.titleStr = title;
        [self.navigationController pushViewController:hotVC animated:YES];
    }
}

@end
